module Main
	where

import Control.Monad
import Data.List
import System.Random

randomNewPoint :: [(Int, Int)] -> IO (Int, Int)
randomNewPoint l = do
		[c,d] <- replicateM 2 $ randomRIO (-1000, 1000)
		if elem (c,d) l
			then randomNewPoint l
			else return (c,d)

randomPoly :: Int -> IO [(Int, Int)]
randomPoly n = foldM (\l _ -> fmap (:l) $ randomNewPoint l) [] [1..n]

printPoly :: [(Int, Int)] -> IO ()
printPoly l = do
		print (length l)
		mapM_ (\(a,b) -> putStrLn $ show a ++ " " ++ show b) l

main = (mapM_ (\n -> randomPoly n >>= printPoly) [4..500]) >> print 0
